package com.easymin.weixin.manager.impl;

import com.easymin.weixin.entity.VCode;
import com.easymin.weixin.manager.VCodeManager;
import com.easymin.weixin.service.VCodeService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by shine on 15/9/28.
 */
@Service
public class DefaultVCodeManager implements VCodeManager {

  @Autowired
  private VCodeService vCodeService;

  @Override
  @Transactional(rollbackFor = Exception.class)
  public int insert(VCode vCode) {

    return vCodeService.insert(vCode);
  }

  @Override
  public VCode findBy(String appKey, String phone) {

    return vCodeService.findBy(appKey, phone);
  }

  @Override
  @Transactional(rollbackFor = Exception.class)
  public int update(VCode vCode) {

    return vCodeService.updateIngoreNull(vCode);
  }

  @Override
  @Transactional(rollbackFor = Exception.class)
  public int deleteBy(String appKey, String phone) {

    return vCodeService.deleteBy(appKey, phone);
  }
}
